package com.endurance.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 读取SpringBoot配置文件中自定义的内容
 */
@RestController
@ConfigurationProperties(prefix = "phone")
 public class PhoneController {
    private String brand;

    private String price;

    @RequestMapping("/phone")
    @ResponseBody
    public String phone() {
        return brand + ":" + price;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }
}
